package WaiBao;

import java.util.Arrays;

public class MiaoTian {
    public static void main(String[] args) {
        String[] name= {"戴嚣张(班长)", "白小白(副班长)", "小李(学习委员)", "张黑子(团支书)", "李大宝", "王大夫", "凌忠中", "沙葱博", "徐导光", "刘庆宇", "刘庆龙", "刘庆全",
                "里流浪", "张燕子", "许格格", "张晓华", "李潇潇", "何以笙", "萧默", "戴雨桐", "王双儿", "任之光", "张瑶瑶", "李玲玲", "里导演", "陈宫", "雍正", "缓缓",
                "胡惟庸", "苗田(学生)"};//考生本人: 苗田(学生)
        int[] age = {19, 20, 20, 20,19, 21, 20, 20, 19, 22,19, 21, 18, 20, 21,20, 18, 18, 18, 18, 19, 19, 20, 20, 20, 21, 19,20,20, 18};//考生年龄：18岁

        double[] sinan1 = {86, 66, 84, 91, 61, 71, 88, 89, 77, 91, 93, 77, 85, 79, 65, 68, 69, 99, 96, 88, 92, 91, 95, 88, 75, 74, 88, 76, 88, 95};
        double[] sinan2 = {88, 75, 89, 76, 77, 82, 81, 89, 94, 80, 91, 77, 86, 75, 65, 65, 86, 79, 66, 68, 82, 71, 90, 86, 75, 80, 76,  65, 97, 98};
        double[] sinan3 = {84, 66, 91, 84, 75, 69, 78, 89, 80, 68, 93, 87, 85, 75, 65, 68, 69, 69, 96, 93, 92, 81, 85, 95, 79, 84, 77, 74, 89, 96};


        double shijie1;//代表每个学生的总分
        double shijie2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            shijie1 = sinan1[i] + sinan2[i] +sinan3[i];
//            shijie2 = (shijie1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + shijie1);
//            System.out.println(name[i] + "的平均分为:" +shijie2);
//        }

        double bobao1 = 0, bobao2 = 0;
        double[] budiao = new double[30];
//        for (int i = 0; i < 30; i++) {
//            bobao1 = sinan1[i] + sinan2[i] +sinan3[i];
//            bobao2= (bobao1 * 1.0) / 3;
//            budiao[i] = bobao2;
//        }
//
//        for (int i = 0; i < budiao.length - 1; i++) {
//            for (int j = 0; j < budiao.length - i - 1; j++) {
//                if (budiao[j] < budiao[j + 1]) {
//                    double tep = budiao[j];
//                    budiao[j] =budiao[j + 1];
//                    budiao[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(budiao[i]);
//        }



        double ye1 = 0,ye2 = 0, ye3 = 0;//计算每门课的平均分
        double shuju1 = 0,shuju2 = 0, shuju3 = 0;//计算每门课标准差
        double three1 = 0, three2 = 0,  three3 = 0;//计算每门课中位数
        double sum2 = 0;
//        for (int i = 0; i <sinan1.length; i++) {
//            sum2+=sinan1[i];
//        }
//        ye1 = (sum2*1.0)/30;
//        System.out.println("生物化学的班级平均分为:"+ye1);
//        double Sum = 0;
//        for (int i = 0; i < sinan2.length; i++) {
//            Sum+=sinan2[i];
//        }
//        ye2 = (Sum*1.0)/30;
//        System.out.println("微生物学的班级平均分为:"+ye2);
//        double sum = 0;
//        for (int i = 0; i <sinan3.length; i++) {
//            sum+=sinan3[i];
//        }
//        ye3 = (sum*1.0)/30;
//        System.out.println("人体组织解剖学的班级平均分为:"+ye3);
//
//
////
//        double c1 = 0,c2 = 0,c3 = 0;
//        for (int i = 0; i <sinan1.length; i++) {
//            c1+= (sinan1[i] -ye1)*(sinan1[i] - ye1);
//        }
//        shuju1 = Math.sqrt(c1*1.0/30);
//        System.out.println("生物化学的班级标准差为:"+shuju1);
//
//        for (int i = 0; i < sinan2.length; i++) {
//            c2+= (sinan2[i] - ye2)*(sinan2[i] - ye2);
//        }
//        shuju2 = Math.sqrt(c2*1.0/30);
//        System.out.println("微生物学的班级标准差为:"+shuju2);
//
//        for (int i = 0; i <sinan3.length; i++) {
//            c3+= (sinan3[i] -ye3)*(sinan3[i] - ye3);
//        }
//        shuju3 = Math.sqrt(c3*1.0/30);
//        System.out.println("人体组织解剖学的班级标准差为:"+shuju3);
////
////
        Arrays.sort(sinan1);
        Arrays.sort(sinan2);
        Arrays.sort(sinan3);
        three1 =( sinan1[14]+sinan1[15])*1.0/2;
        three2 =(sinan2[14]+sinan2[15])*1.0/2;
        three3 =( sinan3[14]+sinan3[15])*1.0/2;
        System.out.println("生物化学的中位数为:"+ three1);
        System.out.println("微生物学的中位数为:"+ three2);
        System.out.println("人体组织解剖学的中位数为:"+ three3);






    }
}
